--
-- Author:      feilong
-- DateTime:    2019-12-16 17:19:33
-- Description: 每日首充活动服务

local skynet = require "skynet"
local Hotfix = require("Hotfix")
local MessageDispatch = import("MessageDispatch")
local ActConfig = import("ActConfig")
local UserManager = import("UserManager")
local MessageHandler = import("shouchong.MessageHandler")
local Desk = import("shouchong.Desk")


--此服务唯一全局变量, 
global = {}
global.hotfix = Hotfix.new()

local function init()

	local message_dispatch = MessageDispatch.new()	
	local message_handler = MessageHandler.new(message_dispatch)
	local config = ActConfig.new()
	local user_manager = UserManager.new()	
	local desk = Desk.new()
	global.message_dispatch = message_dispatch
	global.message_handler = message_handler
	global.config = config
	global.user_manager = user_manager
	global.desk = desk
		

	skynet.register_protocol({
		name = "client",
		id = skynet.PTYPE_CLIENT,
		pack = skynet.pack,
		unpack = skynet.unpack,
	})
	--消息派发
	local func = message_dispatch:dispatchClient()	
	skynet.dispatch("client", func)
	skynet.dispatch("lua", message_dispatch:dispatchLua())	
end

---------------------------------------------------------
-- skynet
---------------------------------------------------------
disable_global()
init()
skynet.start(function()

end)


--